{extend name="index/index" /}
{block name="main"}

<script type="text/javascript" charset="utf-8" src="/static/baidu/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="/static/baidu/ueditor.all.min.js"></script>
<script type="text/javascript" charset="utf-8" src="/static/baidu/lang/zh-cn/zh-cn.js"></script>
<main class="container pt-xs-6" id="pjax-content">
    <div class="row" style='margin:0px;padding:30px;background:#fff;-moz-box-shadow:0 0 10px #ccc;-webkit-box-shadow:0 0 10px #ccc;box-shadow:0 0 10px #ccc;'>
        <div class="col-md-10">
         <form action="/index/post/tjpost" method="post" id='fbpost'>
            <div class="col-md-8">
                <input type="text" class='biginput' placeholder='请输入标题' name='title' value='这是一个标题'>
            </div>
            <div class="col-md-4">
                <span class='h4 '>发布人:admin </span>
                <input type="hidden" class='biginput' placeholder='请输入标题' name='uid' value='{$userinfo["id"]}'>
            </div>
            <div class="col-md-12">
                <div id="post" style="width:100%;height:300px;margin-bottom: 10px"></div>
            </div>
            <div class="col-md-9">
                <div>
                    <span class='h4'>频道: </span>
                    <select name="cid" id='fl' class="selectpicker" data-style="btn-primary">
                         {volist name="channel" id="v" }
                            <option value="{$v.id}">{$v.Name}</option>
                        {/volist}
                    </select>
                    <span class='h4'>话题:</span>
                    <select name="lid"  id='ht' class="selectpicker">
                    </select>
                </div>
            </div>
            <div class="col-md-3">
                <button class="btn-lg btn-info" > 确认发表 </button>
            </div>
         </form>
        </div>
        <div class="col-md-2">
            <span class='h5'>请选择封面:</span>
            <form action="/index/up/upload" enctype="multipart/form-data" method="post">
                <input type="file" name="image" /> <br> 
                <input type="submit" value="上传" /> 
            </form> 
        </div>
    </div>
</main>


<script>
    //实例化编辑器
    var ue = UE.getEditor('post');
    $(function(){
        $('#fl').change(change);

    })
    function change(){
            id = $('#fl').val();
            console.log(id);
            $.get('/index/post/getlabel',{id:id},function(data){
            data = JSON.parse(data);
            $('#ht').empty();
            for (var i = data.length - 1; i >= 0; i--) {
                $('#ht').append('<option value="'+data[i].id+'">'+data[i].name+'</option>');
            };
            })
        }
    change();


</script>






{/block}
